import React, { Component } from 'react';
import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom'
import Tabbar from './components/tabbar/Tabbar';
import Category from './components/category/Category';
import Cart from './components/cart/Cart';
import My from './components/my/My';
import Home from './components/home/Home';
import SearchCenter from './components/Search/searchCenter'
import Error from './components/Error/error'

class RouterConfig extends Component {
    render() {
        return (
            <Router>
                <Switch>
                    <Route path='/category' exact render={() => <Tabbar><Category></Category></Tabbar>}></Route>
                    <Route path='/cart' exact render={() => <Tabbar><Cart></Cart></Tabbar>}></Route>
                    <Route path='/my' exact render={() => <Tabbar><My></My></Tabbar>}></Route>
                    <Route path='/searchCenter' exact render={()=><SearchCenter></SearchCenter>}></Route>
                    <Route path='/' exact render={() => <Tabbar><Home></Home></Tabbar>}></Route>
                    <Route path='/404' exact component={() => <Error></Error>}></Route>
                    <Redirect to='/404'></Redirect>
                </Switch>
            </Router>
        );
    }
}

export default RouterConfig;
